<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="https://cdn.staticfile.org/vue/2.2.2/vue.min.js"></script>
    <script src="https://lib.baomitu.com/axios/0.19.2/axios.js"></script>
</head>
<body>
<div id="app">
    <input type="text" v-model="uname"><br>
    <input type="password" v-model="pwd"><br>
    <button @click="login()">登录</button>
</div>
<script>
    new Vue({
        el:"#app",
        data:{
            uname:"",
            pwd:""
        },
        methods:{
            login:function () {
                var params = new URLSearchParams();
                params.append("uname",this.uname);
                params.append("pwd",this.pwd);
                //
                axios.post("user/login",params)
                    .then(res => {
                        console.info(res.data);
                        if ((res.data=="success")){
                            location.href = "product.html";
                        }
                    })
            }
        }
    });
</script>
</body>
</html>